package abstractfactory;

/**
 * @version 1.0
 * @author:罗苏琴
 * 类型
 * @Date 2024/12/9 上午10:09
 */
public class ApplyFactory implements CalculatorsFactory {

    @Override
    public OperateFactory createFactory(String type) {
        switch (type) {
            case "+":
                return new JiaFactory().createFactory(type);
            case "-":
                return new JianFactory().createFactory(type);
            case "*":
                return new ChengFactory().createFactory(type);
            case "/":
                return new ChuFactory().createFactory(type);
            default:
                throw new IllegalArgumentException("Unknown operation type: " + type);
        }
    }
}
